import axios from '@/utils/request';
const baseOriginURL = process.env.VUE_APP_BASE_ORIGIN + '/iot_common';

// 获取消息通知列表
const getMsgList = params => {
  return axios.get(baseOriginURL + '/message/list', {
    params
  });
};

// 获取消息详情
const getMsgDetail = params => {
  return axios.get(baseOriginURL + '/message/detail', {
    params
  });
};

// 全部已读
const readAllMessage = params => {
  return axios.request({
    method: 'put',
    url: baseOriginURL + '/message/readAllMessage',
    params,
    headers: {
      showLoading: true,
      loadingText: encodeURI('处理中...')
    }
  });
};

// 清空所有信息
const deleteAllMessage = () => {
  return axios.request({
    method: 'put',
    url: baseOriginURL + '/message/deleteAllMessage',
    headers: {
      showLoading: true,
      loadingText: encodeURI('清除中...')
    }
  });
};

export { getMsgList, getMsgDetail, readAllMessage, deleteAllMessage };
